-
Notifications
You must be signed in to change notification settings - Fork 7
refactor: stricter return types, tsconfig cleanup #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| import { escapeString } from '../../helpers/escape.js'; | ||
|
|
||
| export const convertType = (obj: any[] | any, indent?: string, lastIndent?: string): unknown => { | ||
| export const convertType = (obj: any[] | any, indent?: string, lastIndent?: string): string | 'null' => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just type this to string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i kinda like when return types explicitly mention a value that's likely to show up, in case a downstream function wants to act on that value accordingly. no strong preferences on this though
| "useUnknownInCatchVariables": false, | ||
|
|
||
| "strict": true | ||
| "verbatimModuleSyntax": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't seen this one before, what's it do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably enable it everywhere we can. it ensures that type imports use import type SomeType and not import SomeType, which will help us with treeshaking. as always mr. pocock has a good write-up on the subject in his cheat sheet: https://www.totaltypescript.com/tsconfig-cheat-sheet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh cool
rides the coattails of #271 with a few stricter return types and a little
tsconfig.jsoncleanup.